"""
【练习】快速排序
编写一个Python程序，实现快速排序
"""


def fast_sort(num_list):
    if len(num_list) <= 1:
        return num_list

    num = num_list[len(num_list) // 2]
    left = [x for x in num_list if x < num]
    right = [x for x in num_list if x > num]
    middle = [x for x in num_list if x == num]

    return fast_sort(left) + middle + fast_sort(right)



